

const jwt = require('jsonwebtoken')
const secret = "compeq123456" //解密密钥

const JWT ={
    createtoken:(data:any,time:any)=>{
        return jwt.sign(data,secret,{expiresIn:time})
    },
    verifytoken: (token:any)=>{
        try{
            return jwt.verify(token.split(' ')[1],secret)
        }
        catch(err){
            return false
        }
    }
}

export {JWT}